<?php
/**
 * @CopyRight  (C)2006-2011 LiangJing Development team Inc.
 * @WebSite    www.liangjing.org www.asp99.cn
 * @Author     Liangjing.org <asp3721@hotmail.com>
 * @Brief      liangjingcms v1.x
**/
require_once '../source/core/run.php';
require_once 'admin.inc.php';
$action		= Core_Fun::rec_post("action");

switch($action){
    case 'checkcatalog';
	    action_checkcatalog();
		break;
	default;
       echo("");
		break;
}


 function action_checkcatalog() {
	   global $db;
        $response = false;
        $error = '';
	    $name = Core_Fun::rec_post('name',1);
	if(!Core_Fun::ischar($name)){
       $error = '栏目标识格式错误';
	}
    else {

        $sql = "SELECT dirname FROM ".DB_PREFIX."category WHERE dirname='".$name."'";
        $rows = $db->fetch_first($sql);
            if ( $rows["dirname"]==$name) {
                $error = '栏目标识系统禁止使用';
            }
            else {
                if ($rows["dirname"]==$name) {
                    $error = '栏目标识已存在';
                }
                else {
                   
                    $error = 'ok';
                }
            }

        }
        echo $error;
    }
    
    

?>
